import * as api from "./api";
import { dict } from "@fast-crud/fast-crud";
// 构建crudOptions的方法
export default function ({ expose }) {
  const pageRequest = async (query) => {
    return await api.GetList(query);
  };
  const editRequest = async ({ form, row }) => {
    form.id = row.id;
    return await api.UpdateObj(form);
  };
  const delRequest = async (id) => {
    return await api.DelObj(id);
  };

  const addRequest = async ({ form }) => {
    return await api.AddObj(form);
  };
  return {
    crudOptions: {
      //请求配置
      request: {
        pageRequest, // 列表数据请求
        addRequest,  // 添加请求
        editRequest, // 修改请求
        delRequest,  // 删除请求
      },
      columns: {
        name: {
          title: "名称",
          search: { show: true },
          type: "text"
        },
        // 你可以尝试在此处增加更多字段
      },
      // 其他crud配置
    },
  };
}
